#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

//加载并使用插件
void Widget::on_pushButton_clicked()
{
        PluginInterface *interface = 0; //定义插件接口的指针
        QPluginLoader pluginLoader("../Plugin.dll"); //加载插件
        QObject *plugin = pluginLoader.instance(); //实例化插件
        if(plugin)
        {
            interface = qobject_cast<PluginInterface*>(plugin); //得到插件的指针
            if(interface)
            {
                interface->SayHello(this);//调用插件的函数
            }
        }
}
